<template>
  <div class="container">
    <el-card shadow="always">
         <div class="title">食品抽检列表</div>
      <rz-height></rz-height>

      <el-row :gutter="20">
     
        <el-col :span="4">
          <el-select
            v-model="query.planYear"
            placeholder=""
            :clearable="false"
          >
            <el-option
              v-for="item in [2021,2022,2023]"
              :key="item"
              :label="item"
              :value="item"
            >
            </el-option>
          </el-select>
        </el-col>



        <el-col :span="4">
          <el-select
            v-model="query.isQualified"
            placeholder="请选择样品结论"
            :clearable="true"
          >
            <el-option
              v-for="item in [{label:'合格样品',value:'1'},{label:'不合格样品',value:'0'}]"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-col>

           <el-col :span="6"
          ><el-input
            maxlength="50"
            v-model="query.sampleCode"
            placeholder="请输入抽样单号"
            clearable
          ></el-input
        ></el-col>
        <el-col :span="2">
          <el-button
            type="primary"
            @click="
              query.pageIndex = 1;
              getList();
            "
            >搜索</el-button
          >
        </el-col>
      </el-row>
      <rz-height></rz-height>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column prop="sampleCode" label="抽样单号"> </el-table-column>
        <el-table-column prop="sampleDateStr" label="抽样日期"> </el-table-column>
        <el-table-column  label="食品类别">
            <template slot-scope="scope">
            <div>
                    {{scope.row.level1Name}}
            </div>
          </template>
             </el-table-column>
        <el-table-column prop="sampleName" label="样品名称"> </el-table-column>
        <el-table-column prop="sampleConclusion" label="样品结论"> </el-table-column>
        <el-table-column prop="detectionOrg" label="检测机构"> </el-table-column>








    
  
<!-- 
        <el-table-column label="操作" width="180">
          <template slot-scope="scope">
            <el-button size="small" type="primary" @click="viewMenu(scope.row)"
              >查看</el-button
            >
          </template>
        </el-table-column> -->
      </el-table>
      <pagination
        :total="total"
        @pagination="getList"
        :page.sync="query.pageIndex"
      />
    </el-card>
  </div>
</template>
<script>
import {
  findLegalExamination,
} from "@/api/modules/enterprise";
export default {
  // props:[],
  // 页面加载
  created() {
    this.getList();
  },
  // 页面加载完成
  mounted() {},
  //实例销毁之前
  beforeDestroy() {},
  //实例销毁后
  destroyed() {},
  data() {
    return {
      query: {
        id: "",
        pageIndex: 1,
        pageSize: 10,
        planYear: 2023,
        sampleCode: "",
        unId:sessionStorage.getItem("interpretation"),
        isQualified:''
      },
      tableData: [],
      total: 0,
      dialogVisible: false,
      data: {},
    };
  },
  // 方法
  methods: {
    getList() {
      findLegalExamination(this.query).then((res) => {
        this.tableData = res.data.list;
        this.total = res.totalCount;
      });
    },
  },
  // 监听属性
  watch: {},
  // 组件
  components: {},
  // 计算属性
  computed: {},
};
</script>

<style lang="scss" scoped>
.icon-erweima {
  font-size: 40px;
}
 .title {
    font-size: 20px;
    font-weight: 700;
  }
</style>
